<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
$credit_types=credit_types(true);
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('teamsetting',$postdata);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('teamsetting');
	$return['item']['jy_ad']=$this->plugin_exists('jy_ad')?1:0;
	$return['item']['footernav'] = !empty($return['item']['footernav']) ? $return['item']['footernav'] : $footernav;
	$return['item']['image_show']='../addons/jy_robshop/resource/images/image_show.png';
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基础设置',
				'list'=>array(
					array('type'=>'switch','title'=>'开启团分红','name'=>'isopen','isradio'=>1),
					array('type'=>'radio','title'=>'成为默认等级条件','name'=>'become','options'=>'become'),
					array('type'=>'unitstring','unit'=>'元','title'=>'消费金额','name'=>'oneorder_price','show'=>array('become'=>3)),
					array('type'=>'choose_many','title'=>'购买指定商品升级','name'=>'goods_ids','action'=>'jy_weishop/goods.get_goods/many/','choose_title'=>'选择参与的商品','show'=>array('become'=>5)),
					array('type'=>'checkbox','title'=>'团队等级升级要求','name'=>'level_up_types','options'=>'leveltype','help'=>''),
					array('type'=>'switch','title'=>'是否需要审核','name'=>'isshenhe'),
					array('type'=>'switch','title'=>'是否需要完善资料','name'=>'isinfo'),
					array('type'=>'string','title'=>'团队分享二维码说明','name'=>'share_help'),
					array('type'=>'string','title'=>'团队分享标题','name'=>'teamshare_title'),
					array('type'=>'string','title'=>'团队分享描述','name'=>'teamshare_desc'),
					array('type'=>'richtext','title'=>'团队须知','name'=>'team_xieyi'),
				)
			),
			array(
				'title'=>'佣金计算',
				'list'=>array(
					array('type'=>'radio','title'=>'收益转比方式','name'=>'fee_totype','options'=>'fee_totype'),
					array('type'=>'string_two','unit1'=>'%','title1'=>'（N%）转为佣金'.$this->credit5,'unit2'=>'%','title2'=>'（N%）转'.$credit_types[5],'title'=>'收益转比','name1'=>'fee_tofee','name2'=>'fee_tobi5','show'=>array('fee_totype'=>1)),
					array('type'=>'string_two','unit1'=>'%','title1'=>'（N%）转为积分'.$this->credit5,'unit2'=>'%','title2'=>'（N%）转'.$credit_types[5],'title'=>'收益转比','name1'=>'fee_tobi1','name2'=>'fee_tobi5','show'=>array('fee_totype'=>2)),
					array('type'=>'checkbox','title'=>'佣金计算币种','name'=>'fee_paytype','options'=>'credit_type','help'=>'说明一：开启哪一个币种计算佣金，前端就显示那个币种； 说明二：开启那个币种计算佣金，会汇总到会员中心总账户，有流水记录；'),
					array('type'=>'radio','title'=>'佣金计算方式','name'=>'fee_pricetype','options'=>'redfee_pricetype','help'=>'第一种：按商品实际成交价×百分比；第二种：按商品利润：【实际成交价-成本】×百分比；'),
					array('type'=>'checkbox','title'=>'不支持计算佣金支付方式','name'=>'nopay_type','options'=>'pay_type','help'=>'说明：举例勾选抵扣券不支持分红；那么使用实际现金支付将减去抵扣券的额度不计算分红；'),
					array('type'=>'title','title'=>'佣金结算提现设置'),
					array('type'=>'checkbox','title'=>'支持的提现方式','name'=>'withdrawtype','options'=>'withdraw'),
					array('type'=>'unitstring','unit'=>'元','title'=>'结算额度（元）','name'=>'balance_money','help'=>'佣金达到该数值才能结算'),
					array('type'=>'unitstring','title'=>'佣金结算扣除服务费（%）','unit'=>'%','name'=>'balance_per'),
					array('type'=>'switch','title'=>'下单即可结算？','isradio'=>1,'name'=>'isbuy_jiesuan','help'=>'不开启，则表示，必须完成订单才能结算！'),
					array('type'=>'string','title'=>'结算天数','name'=>'balance_day','help'=>'当订单完成后的n天后，佣金才能申请提现,设置0或空，订单完成就可以结算'),
				)
			),
			array(
				'title'=>'团队排位循环奖',
				'list'=>array(
					array('type'=>'unitstring','unit'=>'层','title'=>'封顶拿N层团队层级循环奖','name'=>'team_ceng','help'=>'同排消费，每次排位给上级奖励，N层为一个循环'),
					array('type'=>'radio','title'=>'直推多拿层方式','name'=>'team_timetype','options'=>'team_timetype'),
					array('type'=>'unitstring','unit'=>'次','title'=>'直推消费N次升级多拿1层','name'=>'team_tuitime','show'=>array('team_timetype'=>0),'help'=>'举例直推1人消费1次升级多拿1层'),
					array('type'=>'unitstring','unit'=>'人','title'=>'直推N人多拿1层','name'=>'team_numtime','show'=>array('team_timetype'=>1),'help'=>'举例直推1人多拿1层，直推二人拿二层，推荐12人拿12层'),
					array('type'=>'unitstring','unit'=>'次','title'=>'月度考核自己消费N次获得1层的额度释放值','name'=>'team_sftime','help'=>'举例第五点设置封顶为12层，自己消费1次获得解冻团队层级循环奖十二分之一为一个额度释放值'),
					array('type'=>'radio','title'=>'团队层级循环奖赠送虚拟币','name'=>'team_tobitype','options'=>'team_tobitype','help'=>'第一种：按【拼中】和【单购】金额设置团队层级循环奖励购物积分(【指备用金】)百分比；第二种：按【拼中】和【单购】金额设置团队层级循环奖励积分百分比；（具体奖励比例，前往团队等级设置）'),
					array('type'=>'img_show','title'=>'效果示例','name'=>'image_show'),
				)
			),
			array(
				'title'=>'加权分红',
				'list'=>array(
					array('type'=>'switch','title'=>'开启加权分红按月计算','name'=>'isredopen','isradio'=>1,'help'=>'说明：开启后管理员在后台每个月释放一次上一个月的加权分红收益；'),
					array('type'=>'radio','title'=>'收益转比方式','name'=>'redfee_totype','options'=>'fee_totype'),
					array('type'=>'string_two','unit1'=>'%','title1'=>'（N%）转为佣金'.$this->credit5,'unit2'=>'%','title2'=>'（N%）转'.$credit_types[5],'title'=>'收益转比','name1'=>'redfee_tofee','name2'=>'redfee_tobi5','show'=>array('redfee_totype'=>1)),
					array('type'=>'string_two','unit1'=>'%','title1'=>'（N%）转为积分'.$this->credit5,'unit2'=>'%','title2'=>'（N%）转'.$credit_types[5],'title'=>'收益转比','name1'=>'redfee_tobi1','name2'=>'redfee_tobi5','show'=>array('redfee_totype'=>2)),
					array('type'=>'title','title'=>'设置获得加权分红条件'),
					array('type'=>'unitstring','unit'=>'元','title'=>'当月自己消费最低多少元','name'=>'redfee_checkmyfee'),
					array('type'=>'unitstring','unit'=>'元','title'=>'当月直推金额最低多少元','name'=>'redfee_checktuifee'),
					array('type'=>'switch','title'=>'获得加权分红条件是否每个月都要考核一次','name'=>'redfee_check','isradio'=>1),
					array('type'=>'title','title'=>'其他计算设置'),
					array('type'=>'unitstring','unit'=>'%','title'=>'订单成交价进入到加权分红池%','name'=>'redfee_rate'),
					array('type'=>'checkbox','title'=>'不支持计算加权分红支付方式','name'=>'redfee_paytype','options'=>'credit_type','help'=>'说明：举例勾选抵扣券不支持分红；那么使用实际现金支付将减去抵扣券的额度不计算分红；'),
					array('type'=>'radio','title'=>'加权分红计算方式','name'=>'redfee_pricetype','options'=>'redfee_pricetype','help'=>'第一种：按商品实际成交价×百分比；第二种：按商品利润：【实际成交价-成本】×百分比；'),
				)
			),
		)
	);
	$return['become']=array('0'=>'无条件','1'=>'后台指定','2'=>'提交申请','3'=>'消费金额');
	$return['nfee_sfday']=array('按周','按月');
	$return['team_timetype']=array('按消费N次','按直推N人数');
	$return['team_tiaojians']=$this->team_tiaojians;
	$return['leveltype']=$this->level_up_types;
	$return['redfeetype']=array('0'=>'当月自己消费最低多少元','1'=>'当月直推金额最低多少元【含单购和拼中金额】');
	$return['redfee_pricetype']=$this->commission_types;
	$return['credit_type']=$this->credit_type;
	$return['withdraw']=$this->pay_types;
	$return['pay_type']=get_pay_types();
	$return['fee_totype']=array('0'=>'不转比','1'=>'转比方式1','2'=>'转比方式2');
	$return['team_tobitype']=array('0'=>'团队层级循环奖励购物积分百分比','1'=>'团队层级循环奖励积分百分比');
	$return['htmls']=$htmls;
	exi($return);
}


